import request from '@/utils/request'
import type { IResponseBody } from './userApi'

export interface IStudent {
  id: number
  classId: number
  nickname: string
  account: string
  password: string
}

export interface IGetStudentResponse {
  list: IStudent[]
  page: number
  limit: number
}
export function getStudentAll(
  class_id: number,
  page = 1,
  limit = 100
): Promise<IResponseBody<IGetStudentResponse>> {
  return request.post('/user/findById', {
    class_id,
    page,
    limit
  })
}

export interface IAddStudnetData {
  classId: string
  nickname: string
  account: string
  password: string
}

export function addStudnet(data: IAddStudnetData): Promise<IResponseBody> {
  return request.post('/user/create', data)
}
